﻿$(function () {
    function ChatShow(ContainerID, chat_type, chat_title, chat_x, chat_Data) {
        return chart = new $.Chart3D({
            chart: {
                renderTo: ContainerID,
                type: chat_type
            },
            title: {
                text: chat_title,
                x: -20 //center
            },
            credits: {//隐藏超链接
                enabled: false
            },
            xAxis: {
                categories: chat_x
            },
            yAxis: {
                title: {
                    text: '销售额(万元)'
                },
                formatter: function () {
                    return this.value + "（万元）"
                }
            },
            tooltip: {
                formatter: function () {
                    return '<b>' + this.x + '</b><br/>' +
                        this.series.name + ': ' + this.y;
                }
            },
            legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'top',
                x: -10,
                y: 100,
                borderWidth: 0
            },
            plotOptions: {
                column: {
                    pointPadding: 10
                }
            },
            series: chat_Data
        });
    }
    $(function () {
        var chat_type = "column",
            chat_title = "销售人员季度销售额",
            chat_x = ['第一季度', '第二季度', '第三季度', '第四季度'],
            chat_Data = [{ name: '张珊',
                data: [49.9, 71.5, 106.4, 199]
            }, {
                name: '李斯',
                data: [83.6, 78.8, 98.5, 93.4]
            }];
        var line = ChatShow("divLine", "line", chat_title, chat_x, chat_Data);
        var column = ChatShow("divColumn", "column", chat_title, chat_x, chat_Data);
        var pie = ChatShow("divPie", "pie", '个人销售额', chat_x, [chat_Data[0]]);
    });
});